<?php
Junction_FileCabinet::using("Junction_Utils_Resource_Manager");
/**
 * Utility which stores configuration information for the application
 *
 * @package junction.utils
 * @author Alexander Schearer <aas11@duke.edu>
 */
class Junction_Utils_Config {
	
	/**
	 * Resource manager
	 *
	 * @var Junction_Utils_Resource_Manager
	 */
	private $_resource;
	
	/**
	 * Construct a new configuration manager
	 *
	 * @throws Junction_Utils_Resource_Exception
	 */
	private function __construct() {
		$this->_resource = new Junction_Utils_Resource_Manager($this);
	}
	
	/**
	 * Read information from the config file
	 *
	 * @param String $key
	 * @return String
	 */
	public function read($key) {
		return $this->_resource->getString($key);
	}
	
	/**
	 * Retrieve a single instance of the config utility
	 *
	 * @throws Junction_Utils_Resource_Exception
	 * 
	 * @return Junction_Utils_Config
	 */
	public static function getSingleton() {
		static $singleton;
		if (!isset($singleton)) {
			$singleton = new Junction_Utils_Config();
		}
		return $singleton;
	}
}
?>